package cmd

import (
	"fmt"
	"github.com/spf13/cobra"
	"os"
	"wzgames/internal/constant"
)

var (
	configFile string

	rootCmd = &cobra.Command{
		Use:   "wzgames",
		Short: "WZ Turbo Games.",
		Long:  "WZ Turbo Games.",
	}
)

func RootCmd() *cobra.Command {
	return rootCmd
}

func Execute() {
	if err := rootCmd.Execute(); err != nil {
		_ = fmt.Errorf("rootCmd.Execute failed %s", err.Error())
		os.Exit(1)
	}
}

func init() {
	rootCmd.AddCommand(Version())
	rootCmd.PersistentFlags().StringVar(&configFile, "config", os.Getenv(constant.WzGamesEnv), "config file")
}
